<?php

namespace Database\Factories;

use App\Models\Course;
use App\Models\CourseEvaluate;
use App\Models\Teacher;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Course>
 */
class CourseEvaluateFactory extends Factory
{
    protected $model = CourseEvaluate::class;
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition()
    {
        $courseIds = Course::all()->pluck('id');
        $userIds = User::all()->pluck('id');
        return [
            'user_id' => $userIds->random(),
            'course_id' => $courseIds->random(),
            'star' => fake()->randomElement([1,2,3,4,5]),
            'content' => fake()->sentence,
            'created_at' => fake()->dateTimeBetween('-2 month', '-1 month'),
        ];
    }
}
